//
//  Service+ServeItem.m
//  gskin
//
//  Created by fengyn on 15/12/15.
//  Copyright © 2015年 lexingsoft. All rights reserved.
//

#import "Service+ServeItem.h"


@implementation ServiceManager(ServeItem)
///根据ID获取服务详情
+ (void)getServeItemDetailInfoWithId:(NSString *)itemId success:(void(^)(NSDictionary *data)) success failure:(void(^)(NSDictionary *data)) failure
{
    NSString *path = [NSString stringWithFormat:@"/serveitem/%@",itemId];
    NSDictionary *parameterDict=nil;
    [NetworkClient getRequest:path parameters:parameterDict NeedPrompt:YES success:^(id dataObject) {
        success(dataObject);
    } failure:^(id resultDict) {
        failure(resultDict);
    }];
}

///分页获取服务项目列表
+ (void)getAllServeItemsWithAgencyCode:(NSString *)agencyCode type:(NSString *)type pageIndex:(NSUInteger)pageIndex success:(void(^)(NSDictionary *data)) success failure:(void(^)(NSDictionary *data)) failure
{
    NSString *path = @"/serveitem/public/online/page";
    if (type==kServeItemTypeToStore) {
        path=[NSString stringWithFormat:@"/serveitem/public/offline/%@/page",agencyCode];
    }
    const int countPer=20;
    NSDictionary *parameterDict=@{@"start":@(pageIndex*countPer),
                                  @"length":@(countPer),
                                  };
    [NetworkClient getRequest:path parameters:parameterDict NeedPrompt:YES success:^(id dataObject) {
        success(dataObject);
    } failure:^(id resultDict) {
        failure(resultDict);
    }];
}

///获取上门服务类广告(首页4个特殊服务)
+ (void)getAdvertServeitemSuccess:(void(^)(NSDictionary *data)) success failure:(void(^)(NSDictionary *data)) failure
{
    NSString *path = @"/advertisements/serveitem";
    NSDictionary *parameterDict=nil;
    [NetworkClient getRequest:path parameters:parameterDict NeedPrompt:YES success:^(id dataObject) {
        success(dataObject);
    } failure:^(id resultDict) {
        failure(resultDict);
    }];
}

///常见问题
+ (void)getCommonProblemsWithSuccess:(void(^)(NSDictionary *data)) success failure:(void(^)(NSDictionary *data)) failure
{
    NSString * path = @"/advertisements/faq";
    NSDictionary * dic = nil;
    [NetworkClient getRequest:path parameters:dic NeedPrompt:YES success:^(id dataObject) {
        success(dataObject);
    } failure:^(id dataObject) {
        failure(dataObject);
    }];
}
///查询二级手术分类
+ (void)getClassInfoWithSuccess:(void(^)(NSDictionary *data)) success failure:(void(^)(NSDictionary *data)) failure
{
    NSString * path = @"/category/treeview/sync";
    NSDictionary * dic = nil;
    [NetworkClient getRequest:path parameters:dic NeedPrompt:YES success:^(id dataObject) {
        success(dataObject);
    } failure:^(id dataObject) {
        failure(dataObject);
    }];
}

///根据categorycode获取详情
+ (void)getClassInfoWithCode:(NSString *)code pageIndex:(NSUInteger)pageIndex success:(void(^)(NSDictionary *data)) success failure:(void(^)(NSDictionary *data)) failure
{
    NSString * path = [NSString stringWithFormat:@"/replytemplate/page"];
    const int countPer=20;
    NSDictionary *parameterDict=@{@"start":@(pageIndex*countPer),
                                  @"length":@(countPer),
                                  @"categoryCode":code};
    [NetworkClient getRequest:path parameters:parameterDict NeedPrompt:YES success:^(id dataObject) {
        success(dataObject);
    } failure:^(id dataObject) {
        failure(dataObject);

    }];
}

///根据sequenceNBR获取模板详细信息
+ (void)getTemlpateInfoWithNBR:(NSString *)NBR success:(void(^)(NSDictionary *data)) success failure:(void(^)(NSDictionary *data)) failure
{
    NSString * path = [NSString stringWithFormat:@"/replytemplate/%@",NBR];
    NSDictionary * dic = nil;
    [NetworkClient getRequest:path parameters:dic NeedPrompt:YES success:^(id dataObject) {
        success(dataObject);
    } failure:^(id dataObject) {
        failure(dataObject);
    }];
}

///根据id获取学车指南对应webView
+ (void)getWebViewWithId:(NSString *)Id success:(void(^)(NSDictionary *data)) success failure:(void(^)(NSDictionary *data)) failure
{
    NSString * path = [NSString stringWithFormat:@"/content/information/%@",Id];
    NSDictionary * dic = nil;
    [NetworkClient getRequest:path parameters:dic NeedPrompt:YES success:^(id dataObject) {
        success(dataObject);
    } failure:^(id dataObject) {
        failure(dataObject);
    }];
}
@end
